package web;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Listy { 
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  String driver = "org.h2.Driver";
	try {Class.forName(driver).newInstance();	} catch (InstantiationException e1) {		e1.printStackTrace();	} catch (IllegalAccessException e1) {				e1.printStackTrace();	} catch (ClassNotFoundException e1) {				e1.printStackTrace();	}
	Connection con=null;
	ResultSet rst=null;
	ResultSet rst2=null;
	Statement stmt=null;
	try{		con=DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
		stmt=con.createStatement();
	}
	catch(Exception e){
		System.out.println(e.getMessage());
	}
		try {
			rst=stmt.executeQuery("select * from audycje");
			rst2=stmt.executeQuery("select * from dj");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		response.setContentType("text/html");
		PrintWriter writer = response.getWriter();		

	}
}